<template>
  <div class="app-container">
    <el-row :gutter="20">
      <el-col :span="24" :xs="24">
        <!-- <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="warning"
              icon="el-icon-download"
              size="mini"
              @click="handleExport"
              v-hasPermi="['rank:integral:export']"
            >导出</el-button>
          </el-col>
        </el-row> -->
        <el-table v-loading="loading" :data="rankList" @selection-change="handleSelectionChange">
        <el-table-column label="排名" align="center" prop="rank" />
          <el-table-column label="姓名" align="center" prop="nickname" />
          <el-table-column label="总积分" align="center" prop="sumCount" />
          <el-table-column label="段位" align="center" prop="certificateName" />      
        </el-table>

        <pagination
          v-show="total>0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        />
      </el-col>
    </el-row>
  </div>
</template>

<script>
import {getRankAll} from '@/api/exam/integralRecord'
export default {
  name: "Rank",
  components:{},
  dicts: [],
  data() {
    return {

       // 机构名称
      deptName: undefined,
      // 遮罩层
      loading: true,

      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      genderStatusOptions:[],
      // 排行列表
      rankList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 0,
        pageSize: 15,
      },
      // 表单参数
      form: {
      },
      // 表单校验
      rules: {
        
      },

    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询排行列表 */
    getList() {
      this.loading = true;
      getRankAll(this.queryParams).then(response => {
        this.rankList = response.data.list;
         this.total = response.data.total;
        this.loading = false;
      });
    },
    //排序
    // tableSortChange(column) {
    // console.log(column)
    // return
    //   this.listQuery.pageNo = 1
    //   if (column.order === 'descending') {
    //     this.listQuery.sortby = column.prop
    //     this.listQuery.order = 'desc'
    //   } else {
    //     this.listQuery.sortby = column.prop
    //     this.listQuery.order = 'asc'
    //   }
    // },

    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },

    /** 导出按钮操作 */
    handleExport() {
      this.download('rank/integral/export', {
        ...this.queryParams
      }, `rank_${new Date().getTime()}.xlsx`)
    },
    /** 导入按钮操作 */
    handleImport() {
      this.upload.title = "用户导入";
      this.upload.open = true;
    },
    /** 下载模板操作 */
    importTemplate() {
      this.download('member/UmsMember/importTemplate', {
      }, `member_template_${new Date().getTime()}.xlsx`)
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
      this.getList();
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    }
  }
};
</script>
